luci-mod-network: add carrier info to interface page
authorFlorian Eckert <[email protected]>
Tue, 7 Oct 2025 08:44:18 +0000 (10:44 +0200)
committerFlorian Eckert <[email protected]>
Wed, 15 Oct 2025 09:36:16 +0000 (11:36 +0200)
Currently the LuCI does not show whether a carrier is available on the
interface or not. On ethernet devices the carrier indicates whether a cable
is plugged in or not. This commit adds this functionality, which makes
debugging easier.

Signed-off-by: Florian Eckert <[email protected]>
modules/luci-mod-network/htdocs/luci-static/resources/view/network/interfaces.js

index 4a7f62e8c649ee86aff571a5f6d5f6cb42e13832..548bc65fe41308f349b6e20c5f121322070ea661 100644 (file)
@@ -70,9 +70,11 @@ function render_status(node, ifc, with_device) {
        const changecount = with_device ? 0 : count_changes(ifc.getName());
        const maindev = ifc.getL3Device() ?? ifc.getDevice();
        const macaddr = maindev ? maindev.getMAC() : null;
+       const carrier = maindev ? maindev.getCarrier(): null;
        const cond00 = !changecount && !ifc.isDynamic() && !ifc.isAlias();
        const cond01 = cond00 && macaddr;
        const cond02 = cond00 && maindev;
+       const cond03 = cond00 && carrier;
 
        function addEntries(label, array) {
                return Array.isArray(array) ? array.flatMap((item) => [label, item]) : [label, null];
@@ -81,6 +83,7 @@ function render_status(node, ifc, with_device) {
        return L.itemlist(node, [
                _('Protocol'), with_device ? null : (desc || '?'),
                _('Device'), with_device ? (maindev ? maindev.getShortName() : E('em', _('Not present'))) : null,
+               _('Carrier'), (cond03) ? _('Present') : _('Absent'),
                _('Uptime'), (!changecount && ifc.isUp()) ? '%t'.format(ifc.getUptime()) : null,
                _('MAC'), (cond01) ? macaddr : null,
                _('RX'), (cond02) ? '%.2mB (%d %s)'.format(maindev.getRXBytes(), maindev.getRXPackets(), _('Pkts.')) : null,